package application;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.stage.Stage;

public class ShowEllipse extends Application{

	
	@Override
	public void start(Stage primaryStage) {
		Scene scene = new Scene(new MyElipse(), 300, 200);
		primaryStage.setTitle("ShowEllipse");
		primaryStage.setScene(scene);
		primaryStage.show();
		
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Application.launch(args);
	}

}


class MyElipse extends Pane{
	private void paint() {
		getChildren().clear();
		for (int i = 0; i < 16; i++) {
			Ellipse e1 = new Ellipse(getWidth() / 2, getHeight() / 2, getWidth() / 2 - 50, getHeight() / 2 - 50);

			getChildren().add(e1);
			e1.setFill(Color.WHITE);
			e1.setStroke(Color.color(Math.random(), Math.random(), Math.random()));
			e1.setRotate(i * 180 / 16);
		}
	}
	
	@Override
	public void setWidth(double width) {
		super.setWidth(width);
		paint();
	}
	
	public void setHight(double height) {
		super.setHeight(height);
		paint();
	}
}
